#pragma once

#include <linux/types.h>
#include <linux/errno.h>
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/spinlock.h>

#define PRINTK(...)
#define PRINT_ERR(...)
#define LOS_Panic(...)
#define OsHookCall(...)

#define CLZ(x) __builtin_clz(x)
#define MAX(a, b) ((a) > (b) ? (a) : (b))

typedef spinlock_t MEM_LOCK_S;

/* Spinlock for mem module */
#define __MEM_LOCK_INIT(l)  spin_lock_init(l)
#define __MEM_LOCK(l, state) spin_lock(l)
#define __MEM_UNLOCK(l, state) spin_unlock(l)

typedef struct
{
    unsigned long totalUsedSize;
    unsigned long totalFreeSize;
    unsigned long maxFreeNodeSize;
    unsigned long usedNodeNum;
    unsigned long freeNodeNum;
#ifdef LOSCFG_MEM_WATERLINE
unsigned long usageWaterLine;
#endif
} LOS_MEM_POOL_STATUS;

int OsMemPoolInit(void *pool, uint32_t size);
void *LOS_MemAlloc(void *pool, uint32_t size);
int LOS_MemFree(void *pool, void *ptr);
